package com.eight.qianTeacher.service.impl;

import com.eight.common.pojo.EduCourse;
import com.eight.qianTeacher.dao.EduCourseDao;
import com.eight.qianTeacher.service.EduCourseService;
import com.eight.qianTeacher.vo.ObjVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;

/**
 * @author 向文豪
 * @program: eight-education-parent
 * @description:
 * @date 2023/6/6 19:02
 */
@Service
public class EduCourseServiceImpl implements EduCourseService {

    @Resource
    private EduCourseDao eduCourseDao;
    public Integer updateCourse(ObjVo objVo) {

        EduCourse eduCourse = new EduCourse();
        eduCourse.setCover(objVo.getCover());
        eduCourse.setTitle(objVo.getTitle());
        eduCourse.setPrice(objVo.getPrice());
        eduCourse.setGmtModified(LocalDateTime.now());
        eduCourse.setSubjectParentId(objVo.getCategoryId1());
        eduCourse.setSubjectId(objVo.getCategoryId2());
        eduCourse.setId(objVo.getId());

        int i = eduCourseDao.updateById(eduCourse);
        return i;

    }
}
